package cn.mrcode.smartPluginSecurity.realm;

import cn.mrcode.smartFramework.helper.DataBaseHelper;
import cn.mrcode.smartPluginSecurity.SecurityConfig;
import org.apache.shiro.realm.jdbc.JdbcRealm;

/**
 * @author zhuqiang
 * @version V1.0
 * @date 2015/11/16 21:10
 */
public class SmartJdbcRealm extends JdbcRealm {
    public SmartJdbcRealm() {
        super.setDataSource(DataBaseHelper.getDataSource());
        super.setAuthenticationQuery(SecurityConfig.getAuthenticationQuery());
        super.setUserRolesQuery(SecurityConfig.getUserRolesQuery());
        super.setPermissionsQuery(SecurityConfig.getPermissionsQuery());
        super.setPermissionsLookupEnabled(true);
        super.setCredentialsMatcher(new Md5CredentialsMatcher());
    }
}
